anthill = {};

anthill.getPropertyValue = function (elem, prop) {
	if (elem.currentStyle)
		var y = elem.currentStyle[prop];
	else if (window.getComputedStyle)
		var y = document.defaultView.getComputedStyle(elem,null).getPropertyValue(prop);
	return y;
};

anthill.getContrastColor = function (color) {
	var tmp = document.createElement('div');
	tmp.style.color = color;
	var propColor = this.getPropertyValue(tmp, 'color');
	var re = /rgb\((\d+), (\d+), (\d+)\)/;
	var rgb = re.exec(propColor);
	var
		r = parseInt(rgb[1], 10),
		g = parseInt(rgb[2], 10),
		b = parseInt(rgb[3], 10);
	var brightness = (r*299 + g*587 + b*114) / 1000;
	if (brightness > 125) {
		return '#000000';
	} else {
		return '#ffffff';
	}
};